/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bookshop.framework;

import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;


public class PerformancesMonitor {
    
    private Monitor monitor;
    
    public void start(String label) {
        this.setMonitor( MonitorFactory.start(label) );
    }
    public void stop() {
        monitor.stop();
    }

    public void logResponseTime() {
        String log = "[" + this.getMonitor().getLastAccess() + "] Temps de réponse du webservice : " + this.getMonitor().getMax() + ".";
        System.out.println(log);
    }
    
    
    
    //**************************************************************************
    // ACCESSEURS **************************************************************
    //**************************************************************************
    public Monitor getMonitor() {
        return monitor;
    }
    public void setMonitor( Monitor newMonitor ) {
        this.monitor = newMonitor;
    }
    
    
}
